#ifndef SWP_MERGE_GRAPHIC_ITEM_H
#define SWP_MERGE_GRAPHIC_ITEM_H

#include "abstractpolygongraphicitem.h"

#include <rectgraphicitem.h>

namespace swp
{

class SwpMergeGraphicItem : public AbstractPolygonGraphicItem
{
public:
    SwpMergeGraphicItem(QGraphicsItem* parent = 0);
    ~SwpMergeGraphicItem();

    // IEditorItem
    virtual bool supportsConnection(
        const core::ConnectionData& connection) const;

    virtual int type() const;

    QString name() const;

    virtual IEditorItem* copy() const;

    // IPropertyObject
    QList<core::Property> properties() const;

    QVariant propertyValue(const QString& propertyName) const;

    void propertyChanged(const QString& property,
        const QVariant& newValue, bool silent = false);

    virtual QVariantList optionList(const QString& propertyName) const;
    virtual QVariantList autocomplete(const QString& propertyName) const;

protected:
    // AbstractPolygonGraphicItem
    QList<QPointF> scalePoints() const;
    QList<QPointF> connectPoints() const;
    QList<QPointF> selfConnectAnchorPoints() const;

private:
    bool containsSameConnection(const core::ConnectionData& connection,
        const QList<core::ConnectionData>& connections) const;
    int incomingConnectionSize(
        const QList<core::ConnectionData>& connections) const;
    int outgoingConnectionSize(
        const QList<core::ConnectionData>& connections) const;
};

}

#endif
